//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package study.API.集合.Map;

import java.io.PrintStream;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.function.BiConsumer;

public class Map_demo {
    public Map_demo() {
    }

    public static void main(String[] args) {
        Map<String, String> map = new HashMap();
        System.out.println((String)map.put("张三", "北京"));
        map.put("李四", "南京");
        map.put("王五", "河南");
        System.out.println((String)map.put("张三", "上海"));
        System.out.println((String)map.remove("王五"));
        System.out.println(map.containsKey("张三"));
        System.out.println(map.containsValue("河南"));
        System.out.println(map.size());
        System.out.println(map);
        map.clear();
        System.out.println(map);
        System.out.println(map.isEmpty());
        Map<String, String> map1 = new HashMap();
        map1.put("张三", "北京");
        map1.put("李四", "南京");
        map1.put("王五", "河南");
        Set<String> Keys = map1.keySet();
        System.out.println("---------------------增强for");

        for(String key : Keys) {
            String value = (String)map1.get(key);
            System.out.println(key + "  " + value);
        }

        System.out.println("---------------------迭代器");

        for(String key : Keys) {
            System.out.println(key + "  " + (String)map1.get(key));
        }

        System.out.println("---------------------lambda");
        Keys.forEach((str) -> System.out.println(str + "  " + (String)map1.get(str)));
        Map<String, String> map2 = new HashMap();
        map2.put("张三", "北京2");
        map2.put("李四", "南2京");
        map2.put("王五", "河南2");
        Set<Map.Entry<String, String>> entries = map2.entrySet();
        System.out.println("-------------------增强for");

        for(Map.Entry<String, String> entry : entries) {
            PrintStream var10000 = System.out;
            String var10001 = (String)entry.getKey();
            var10000.println(var10001 + "  " + (String)entry.getValue());
        }

        System.out.println("-------------------迭代器");

        for(Map.Entry<String, String> entry : entries) {
            PrintStream var16 = System.out;
            String var17 = (String)entry.getKey();
            var16.println(var17 + "  " + (String)entry.getValue());
        }

        System.out.println("-------------------Lambda表达式");
        entries.forEach((str) -> {
            PrintStream var10000 = System.out;
            String var10001 = (String)str.getKey();
            var10000.println(var10001 + "  " + (String)str.getValue());
        });
        System.out.println("-----------------------------------------");
        Map<String, String> map3 = new HashMap();
        map3.put("张三", "北京3");
        map3.put("李四", "南京3");
        map3.put("王五", "河南3");
        map3.forEach(new BiConsumer<String, String>() {
            public void accept(String key, String value) {
                System.out.println(key + "  " + value);
            }
        });
        System.out.println("-------------------------");
        map3.forEach((key, value) -> System.out.println(key + " " + value));
    }
}
